ShinyStudio is a Docker image which extends rocker/verse to include RStudio, Shiny Server, VS Code, and ShinyProxy.
ShinyStudio leverages ShinyProxy to provide:
The ShinyStudio image consists of the products described below:
The GitHub repo for ShinyStudio contains two major branches: base and master.
base branch is used to build the image published on DockerHub. The image is great for a personal instance, a quick demo, or the building blocks for a very customized setup.master branch builds upon the base image to provide an example of a more enterprise-ready setup of ShinyStudio.Setup must be run as a non-root user.
Setup of the base image can be done entirely with Docker.
First, create a network named shinystudio-net to be shared by all spawned containers.
docker network create shinystudio-net
Then, pull and run the ShinyStudio image directly from DockerHub.
docker run --rm -it --name shinyproxy \
--network shinystudio-net \
-v /var/run/docker.sock:/var/run/docker.sock \
-e USERID=$USERID \
-e USER=$USER \
-e PASSWORD=password \
-e MOUNTPOINT="${HOME}/ShinyStudio" \
-e SITEID=default \
-p 8080:8080 \
dm3ll3n/shinystudio
Once complete, open a web browser and navigate to http://<hostname>:8080. Log in with your username and the password password.
For a more customized experience, alter pertinent environment variables and bind local volumes to the Docker image. A more personalized setup could look like:
docker run --rm -it --name shinyproxy \
--network shinystudio-net \
-v /var/run/docker.sock:/var/run/docker.sock \
-e USERID=$USERID \
-e USER=$USER \
-e PASSWORD=p@ssw0rd123 \
-e MOUNTPOINT="${HOME}/ShinyStudio" \
-e SITEID=MyShinyStudio \
-p 8080:8080 \
-v "${PWD}/application.yml:/opt/shinyproxy/application.yml"
-v "${PWD}/imgs/background.png:/opt/shinyproxy/templates/grid=layout/assets/img/background.png" \
-v "${PWD}/imgs/logo.png:/opt/shinyproxy/templates/grid=layout/assets/img/logo.png"
dm3ll3n/shinystudio
Explained:
MOUNTPOINT defines the path to store site content and user settings.SITEID defines the folder name that this site’s content will reside in ($MOUNTPOINT/sites/$SITEID).application.yml specifies a custom ShinyProxy configuration file (read more here).background.png and logo.png allow easy personalization of the site background and logo.Setup of the master branch requires both Docker and docker-compose.
For a more out-of-the-box setup, consider cloning/forking the master branch from GitHub. e.g.,
# Clone the master branch.
git clone https://github.com/dm3ll3n/ShinyStudio
# Enter the new directory.
cd ShinyStudio
# Setup and run.
./control.sh setup
The default mountpoint is $PWD/content. To specify another mountpoint, pass the desired path as an argument to the setup:
./control.sh setup "${HOME}/ShinyStudio"
Once complete, open a web browser and navigate to http://<hostname>:8080.
The default logins are:
user: useradmin: adminsuperadmin: superadminOpen your IDE of choice and notice two important directories:
Files must be saved in either of these two directories in order to persist between sessions.
These two folders are shared between instances RStudio, VS Code, and Shiny Server. So, creating new content is as simple as saving a file to the appropriate directory.
The ShinyStudio image comes with…
…and ODBC drivers for:
These are persistent because they are built into the image.
Apps / drivers installed through RStudio/VS Code will not persist.
Libraries for R, Python, and PowerShell will persist. Additionally, user workspace settings (e.g. themes) are persistent.
The details below apply only to the master branch setup.
Authentication is managed by ShinyProxy, which supports basic auth, LDAP, Kerberos, and others (read more).
By default, ShinyStudio defines three levels of access:
Admin/Superadmin landing page:
Readers:
To apply a custom security configuration, modify the ShinyProxy configuration file for the site. All available options are detailed here.
./sites/8080.yml
Open 8080.yml and edit the following lines as desired:
authentication: simple
users:
- name: superadmin
password: *change*me*
groups: superadmins
- name: admin
password: *change*me*
groups: admins
- name: user
password: *change*me*
groups: readers
After modifying any part of the configuration, stop and re-setup the site with:
Multiple instances of ShinyProxy can be mapped to different ports in order to segment content or provide unique customizations.
The configs below will setup two unique, independent instances of ShinyStudio, hosted on ports 8080, 8081.
./sites/8080.yml
./sites/8081.yml